package group2.model;

import java.util.List;

public class BooksCar {
    private Integer book_id;
    private String user_id;
    private int book_num;
    private Book book;
    private ShopCar shopCar;
    private double subTotal;//小计

    public BooksCar(Integer buycar_id, String user_id, int book_num, List<Book> bookList) {
        this.book_id = buycar_id;
        this.user_id = user_id;
        this.book_num = book_num;
    }

    public BooksCar() {
    }

    public ShopCar getShopCar() {
        return shopCar;
    }

    public void setShopCar(ShopCar shopCar) {
        this.shopCar = shopCar;
    }

    public Integer getBook_id() {
        return book_id;
    }

    public void setBook_id(Integer book_id) {
        this.book_id = book_id;
    }

    public String getUser_id() {
        return user_id;
    }

    public void setUser_id(String user_id) {
        this.user_id = user_id;
    }

    public int getBook_num() {
        return book_num;
    }

    public void setBook_num(int book_num) {
        this.book_num = book_num;
    }


    public double getSubTotal() {

        return book.getPrice()*getBook_num();
    }

    public void setSubTotal(double subTotal) {
        this.subTotal = subTotal;
    }

    public Book getBook() {
        return book;
    }

    public void setBook(Book book) {
        this.book = book;
    }

    @Override
    public String toString() {
        return "BooksCar{" +
                "book_id=" + book_id +
                ", user_id='" + user_id + '\'' +
                ", book_num=" + book_num +
                ", book=" + book +
                ", shopCar=" + shopCar +
                ", subTotal=" + subTotal +
                '}';
    }
}
